<?php
class Mf_modelModel {
	static $_table = 'mf_model';
	static $_pk = 'mid';
	static $_db = null;

	static function db(){
		if(self::$_db)
			return self::$_db;
		
		self::$_db = DbLib::getDbStatic('',self::$_table,self::$_pk);
		return self::$_db;
	}
	
	public static function __callStatic($func, $arguments){
		return call_user_func_array(array(self::db(),$func), $arguments);
	}
	public static function _getRow($menuName){
		return self::db()->getRow("SELECT 1 FROM `mf_model` WHERE 1 AND `name` = '".$menuName."' AND `is_show` = 'Y' ");
	}
	public static function _add($data){
		return self::db()->add($data);
	}
	public static function _update($data,$table = '',$where){
		return self::db()->update($data,$table,$where);
	}
	public static function _getAll(){
		return self::db()->getAll("SELECT * FROM `mf_model` WHERE 1 ");
	}
	public static function _getAllByPid($pid){
		return self::db()->getAll("SELECT * FROM `mf_model` WHERE `present_id` = ".$pid);
	}

	static function getTableAll($table,$filed = '*',$where){
		return self::db()->getTableAll($table,$filed,$where);
	}
}